<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */

use App\Controller\WebSocketController;
use Hyperf\HttpServer\Router\Router;

Router::addServer('ws', function () {
    Router::get('/', WebSocketController::class);
});
Router::get('/demo', [\App\Controller\DemoController::class, 'index']);


//Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');
Router::addRoute(['GET', 'POST', 'HEAD'], '/', [\App\Controller\IndexController::class, 'index']);

Router::addGroup('', function () {
    Router::addGroup('/auth/', function () {
        Router::post('login', [\App\Controller\AuthController::class, 'login']);
    });
});

Router::addGroup('', function () {
    Router::addGroup('/auth/', function () {
        Router::get('info', [\App\Controller\AuthController::class, 'info']);

    });
}, ['middleware' => [\App\Middleware\JwtAuthMiddleware::class]]);
